package com.ruoyi.exam.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.exam.domain.PVideo;
import com.ruoyi.exam.mapper.PVideoMapper;
import com.ruoyi.exam.service.IPVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 视频Service业务层处理
 *
 * @author ruoyi
 * @date 2022-01-05
 */
@Service
public class PVideoServiceImpl implements IPVideoService
{
    @Autowired
    private PVideoMapper pVideoMapper;

    /**
     * 查询视频
     *
     * @param id 视频主键
     * @return 视频
     */
    @Override
    public PVideo selectPVideoById(Long id)
    {
        return pVideoMapper.selectPVideoById(id);
    }

    /**
     * 查询视频列表
     *
     * @param pVideo 视频
     * @return 视频
     */
    @Override
    public List<PVideo> selectPVideoList(PVideo pVideo)
    {
        return pVideoMapper.selectPVideoList(pVideo);
    }

    /**
     * 新增视频
     *
     * @param pVideo 视频
     * @return 结果
     */
    @Override
    public int insertPVideo(PVideo pVideo,String userName)
    {
        pVideo.setCreateBy(userName);
        pVideo.setCreateTime(DateUtils.getNowDate());
        return pVideoMapper.insertPVideo(pVideo);
    }

    /**
     * 修改视频
     *
     * @param pVideo 视频
     * @return 结果
     */
    @Override
    public int updatePVideo(PVideo pVideo,String userName)
    {
        pVideo.setUpdateBy(userName);
        pVideo.setUpdateTime(DateUtils.getNowDate());
        return pVideoMapper.updatePVideo(pVideo);
    }

    /**
     * 批量删除视频
     *
     * @param ids 需要删除的视频主键
     * @return 结果
     */
    @Override
    public int deletePVideoByIds(Long[] ids)
    {
        return pVideoMapper.deletePVideoByIds(ids);
    }

    /**
     * 删除视频信息
     *
     * @param id 视频主键
     * @return 结果
     */
    @Override
    public int deletePVideoById(Long id)
    {
        return pVideoMapper.deletePVideoById(id);
    }
}
